Skip to content

Expose min_funding_satoshis via Config#844

Open
vincenzopalazzo wants to merge 1 commit intolightningdevkit:mainfrom
vincenzopalazzo:claude/goofy-jemison
Open

Expose min_funding_satoshis via Config#844
vincenzopalazzo wants to merge 1 commit intolightningdevkit:mainfrom
vincenzopalazzo:claude/goofy-jemison

Conversation

@vincenzopalazzo
Copy link
Contributor

@vincenzopalazzo vincenzopalazzo commented Mar 25, 2026

Summary

  • Add min_funding_sats field to Config that maps to LDK's ChannelHandshakeLimits::min_funding_satoshis
  • Server operators can now enforce a higher minimum channel funding amount for inbound channels (default remains 1000 sats)
  • Updated UniFFI bindings

Fixes #842

Test plan

  • cargo check passes
  • cargo test --lib config passes
  • CI passes

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

cc @tankyleo

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Mar 25, 2026

👋 Thanks for assigning @tankyleo as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

Add `min_funding_sats` field to `Config` that maps to LDK's
`ChannelHandshakeLimits::min_funding_satoshis`. This allows server
operators to enforce a higher minimum channel funding amount for
inbound channels, overriding the default of 1000 sats.

Fixes lightningdevkit#842

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tankyleo tankyleo self-requested a review March 25, 2026 16:40
Copy link
Contributor

@tankyleo tankyleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have cleaned it up like this; I don't think it's worth adding the Option there, the config setting logically is just a single number.

diff --git a/src/config.rs b/src/config.rs
index ffd9d134..d6402257 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -28,6 +28,7 @@ const DEFAULT_LDK_WALLET_SYNC_INTERVAL_SECS: u64 = 30;
 const DEFAULT_FEE_RATE_CACHE_UPDATE_INTERVAL_SECS: u64 = 60 * 10;
 const DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER: u64 = 3;
 const DEFAULT_ANCHOR_PER_CHANNEL_RESERVE_SATS: u64 = 25_000;
+const DEFAULT_MIN_FUNDING_SATS: u64 = 1000;

 // The default timeout after which we abort a wallet syncing operation.
 const DEFAULT_BDK_WALLET_SYNC_TIMEOUT_SECS: u64 = 60;
@@ -125,7 +126,7 @@ pub(crate) const LNURL_AUTH_TIMEOUT_SECS: u64 = 15;
 /// | `node_alias`                           | None               |
 /// | `trusted_peers_0conf`                  | []                 |
 /// | `probing_liquidity_limit_multiplier`   | 3                  |
-/// | `min_funding_sats`                     | None               |
+/// | `min_funding_sats`                     | 1000               |
 /// | `anchor_channels_config`               | Some(..)           |
 /// | `route_parameters`                     | None               |
 /// | `tor_config`                           | None               |
@@ -172,13 +173,7 @@ pub struct Config {
        /// they open inbound channels to us.
        ///
        /// Channels with funding below this value will be rejected.
-       ///
-       /// If unset, the `rust-lightning` default of `1000` sats will be used.
-       ///
-       /// Please refer to [`ChannelHandshakeLimits::min_funding_satoshis`] for further details.
-       ///
-       /// [`ChannelHandshakeLimits::min_funding_satoshis`]: lightning::util::config::ChannelHandshakeLimits::min_funding_satoshis
-       pub min_funding_sats: Option<u64>,
+       pub min_funding_sats: u64,
        /// Configuration options pertaining to Anchor channels, i.e., channels for which the
        /// `option_anchors_zero_fee_htlc_tx` channel type is negotiated.
        ///
@@ -222,7 +217,7 @@ impl Default for Config {
                        announcement_addresses: None,
                        trusted_peers_0conf: Vec::new(),
                        probing_liquidity_limit_multiplier: DEFAULT_PROBING_LIQUIDITY_LIMIT_MULTIPLIER,
-                       min_funding_sats: None,
+                       min_funding_sats: DEFAULT_MIN_FUNDING_SATS,
                        anchor_channels_config: Some(AnchorChannelsConfig::default()),
                        tor_config: None,
                        route_parameters: None,
@@ -352,9 +347,7 @@ pub(crate) fn default_user_config(config: &Config) -> UserConfig {
        // will mostly be relevant for inbound channels.
        let mut user_config = UserConfig::default();
        user_config.channel_handshake_limits.force_announced_channel_preference = false;
-       if let Some(min_funding_sats) = config.min_funding_sats {
-               user_config.channel_handshake_limits.min_funding_satoshis = min_funding_sats;
-       }
+       user_config.channel_handshake_limits.min_funding_satoshis = config.min_funding_sats;
        user_config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx =
                config.anchor_channels_config.is_some();
        user_config.reject_inbound_splices = false;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose UserConfig::channel_handshake_limits::min_funding_satoshis

3 participants